package CSDN;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 王圆豪
 * Date: 2025-05-20
 * Time: 23:59
 */
public class Test25 {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService executorServiceFix = Executors.newFixedThreadPool(10);
//        ExecutorService executorServiceCache = Executors.newCachedThreadPool();
        for (int i = 0; i < 10; i++) {
            int id = i;
            executorServiceFix.submit(()->{
                System.out.println(Thread.currentThread().getName()+
                        "执行任务" + id);
            });
        }
        executorServiceFix.shutdown();
//        executorServiceFix.awaitTermination(1, TimeUnit.SECONDS);
    }
}
